A-2 WiseVIEW ActiveX Control
WiseVIEW offers ActiveX Control( WiseVIEW.ocx) version.
1. Registration of WiseVIEW ActiveX Control
Installation program automatically registers WiseVIEW ActiveXcontol. You can also register by yourself using the Dos command below.
- Regsvr 32.exe wiseview.ocx
2. Usage of WiseVIEW ActiveX Control
When WiseVIEW ActiveX Control is correctly installed, you can use it by inserting it into your own program through Visual C+, Visual Basic, Power Builder, and etc.
Figure 1 is an example of reading STL file through ActiveX Control Test Container program (tstcon32.exe) of C++ after inserting WiseVIEW ActiveX Control.
3. Method of WiseVIEW ActiveX Control
WiseVIEW ActiveX Control provides file input/output related Method, menu control related Method, Tool bar and Status bar control Method, text search related Method, and more for efficient integration with other systems
3.1 File input/output Method
LoadFile
Declaration:
BOOL LoadFile (LPCTSTR fileName);
Arguments:
fileName : name of the file you want to open
Description: This Method is used for reading the specific file and closes the previously opened file. If it reads the corresponding file correctly, return TRUE, and if not, return FALSE.
OpenURL
Declaration:
BOOL Open URL (LPCTSTR fileName);
Arguments:
fileName: name of the file you want to open
Description:
This Method is used for loading the file of another IP Address and closes the previously opened file. If it reads the corresponding file correctly, return TRUE, and if not, return FALSE.
LoadDXF
Declaration:
Short LoadDXF (LPCTSTR fileName);
Arguments:
FileName : name of DXF file of AutoCAD you want to open
Description:
This Method is used for reading AutoCAD DXF file and closes the previously opened file. If it reads the corresponding file correctly, return TRUE, and if not, return FALSE.
LoadMVLPage
Declaration:
BOOL LoadMVLPage (LPCTSTR fileName, LPCTSTR page)
Arguments:
FileName : name of MVL file you want to open
Page: Specific page of MVL file you want to open
Description:
This Method is used for reading the specific page of MVL file. If it reads correctly, return TRUE, and if not, return FALSE.
GotoPageinMVL
Description:
BOOL GotoPagein MVL (LPCTSTR page);
Arguments:
Page : specific page
Description:
This Method is used for moving to the specific page of MVL file. If it moves correctly, return TRUE, and if not, return FALSE.
ProtectFile
Declaration:
BOOL ProtectFile (LPCTSTR fileName);
Arguments:
FileName: name of the file you want to open with Protect Mode
Description:
This Method is used for reading the specific file with Protect Mode. You cannot copy or delete file, and if WiseVIEW gets shut down or another file is read, current file gets deleted.
SetReadOption
Declaration:
void SetReadOption (BOOL bNewValue);
Arguments:
bNewValue: it is a kind of variable that decides whether the current file should be set up as read only file or not. If TRUE, it sets up as read only, and if FALSE, it cancels read only.
Description:
This Method is used for setting up current file as read only file. If file gets fixed as read only, you cannot save or print.
GetReadOption
Declaration:
BOOL GetReadOption ();
Description:
This Method is used for checking read only status. If the current file gets set up as read only, return TRUE, and if not, return FALSE.
Print()
Declaration:
Void Print ();
Description:
This method is used for printing the current file.
SetPrintScale
Declaration:
BOOL SetPrintScale (BOOL bFit , double scale);
Arguments:
bFit : it is a kind of variable that decides whether the file should be printed fit to the printing paper size.
scale: it is a kind of variable that sets the printing ratio of the file
Description: This Method is used for setting the printing ratio of the file. If you want to print with the specific ratio, you should set bFit(FALSE) and scale.
SetHeader
Declaration:
BOOL SetHeader (LPCTSTR header);
Arguments:
header : text of header
Description:
This Method is used for setting the text of header
SetFooter
Declaration:
BOOL SetFooter (LPCTSTR footer);
Arguments:
footer: text for footer
Description:
This Method is used for setting the text of footer
SetFooterHeight
Declaration:
BOOL SetFooterHeight (int pixel);
Arguments:
Pixel: text size of header and footer, pixel unit
Description:
This Method is used for setting text size of header and footer.
SetFooterFont
Declaration:
BOOL SetFooterFont (LPCSTR footer);
Arguments:
footer : name of the font for header and footer, Default: Arial font
Description:
This Method is used for setting the font of header and footer.
DirectPrint
Declaration:
BOOL DirectPrint();
Description:
Print directly without opening print option dialog.
SetDPrintAsFile
Declaration:
BOOL SetDPrintAsFile(BSTR output);
Arguments:
output : the name of output file
Description:
It is used with the function "DirectPrint". Print out as the file.
SetDPrinter
Declaration:
BOOL SetDPrinter(BSTR printer);
Arguments:
printer : the name of printer
Description:
Setup the printer.
SetDPrintPaper
Declaration:
BOOL SetDPrintPaper(BSTR paper);
Arguments:
paper : the size(ex: A4,A3,B4,B3,Letter..)
Description:
choose the size of paper
SetPrintOffset
Declaration:
BOOL SetPrintOffset(double xoffset, double yoffset);
Arguments:
xoffset: the offset value of x-coordinate
yoffset: the offset value of y-coordinate
Description:
set up the offset
SetDPaperOrientation
Declaration:
BOOL SetDPaperOrientation(short flag);
Arguments:
flag: the direction of paper(0: default, 1: Portrait, 2: Landscape)
Description:
choose the direction of paper
SetDFaxNumber
Declaration:
BOOL SetDFaxNumber(BSTR number);
Arguments:
number: the fax number
Description:
set up the fax number when user want to print out to fax server.
SetDFaxServer
Declaration:
BOOL SetDFaxServer(BSTR servername);
Arguments:
servername: the name of Fax Server
Description:
choose the fax server
AddWaterMark
Declaration:
short AddWaterMark(double x, double y, double h, double a, double d, BSTR str);
Arguments:
x: x-coordinate value of start point(unit: mm, origin: left and bottom )
y: x-coordinate value of start point(unit: mm, origin: left and bottom )
h: the height of string (unit: mm)
a: the angle of string (unit: degree)
d: the density of string(unit: %)
str: string to be printed
Description:
This method is used to print string in the specified position of paper.
RemoveAllWaterMark
Declaration:
short RemoveAllWaterMark();
Description:
This method is used to remove the previous string.
Unload
Declaration:
short Unload();
Description:
This method is used to close the opened file.
GetTotalPage
Declaration:
short GetTotalPage();
Description:
This method is used to return the number of page.
GetCurrentPage
Declaration:
short GetCurrentPage();
Description:
This method is used to return the current page.
SetCurrentPage
Declaration:
boolean SetCurrentPage(short curPage);
Arguments:
curPage : Current Page
Description:
This method is used to move to the specified page.
SetDWGReadOption
Declaration:
short SetDWGReadOption(short nFlag);
Arguments:
nFlag: Read Option of AutoCAD DWG (0 : Fast Read, 1 : Fast Display, 2 : Simple Display)
Description:
This method is used to choose the read option of AutoCAD DWG.
3.2 Method related to word search
For MS office documents, WiseVIEW provides the function for searching and moving the specific word
SearchDialog
Declaration:
BOOL SearchDialog ();
Description:
This Method is used for activating Search dialog.
Search
Declaration:
BOOL Search (LPCTSTR word);
Arguments:
Word: specific word that you want to search
Description: This Method is used for searching the specific word without activating Search dialog
SetMatchCase
Declaration:
Void SetMatchCase (BOOL bNewValue );
Arguments:
bNewValue: it is a kind of variable that decides whether word should be classified for capital letter and small letter or not. If TRUE, it classifies capital letter from small letter, and if FALSE, it doesn't.
Description: This Method is used for deciding whether word should be classified for capital letter and small letter or not.
GetMatchCase
Declaration:
BOOL GetMatchCase ();
Description: This Method is used for obtaining information about the capital and small letter classification. If TRUE, it classifies capital letter from small letter, and if FALSE, it doesn't.
First
Declaration:
BOOL First();
Description:
This Method is used for going back to the position of the first word among all that have been currently searched.
Last
Declaration:
BOOL Last ();
Description:
This Method is used for moving to the position of the last word among all that have been currently searched.
Next
Declaration:
BOOL Next();
Description:
This Method is used for moving to the next word from the current position among all that have been currently searched.
Prev
Declaration:
BOOL Prev();
Description:
This Method is used for moving to the previous word from the current position among all that have been currently searched.
3.3 Display
EnableToolBar
Declaration:
BOOL EnableToolBar (BOOL bEnable);
Arguments;
bEnable : it is a kind of variable that selects whether basic tool bar should be used or not. If TRUE, it uses, and if FALSE, it doesn't.
Description: This Method is used for deciding whether basic tool bar should be used or not. WiseVIEW ActiveX Control offers basic tool bar with fundamental file input/output menu, view menu, and word search menu.
EnableStatusBar
Declaration:
BOOL EnableStatusBar (BOOL bEnable );
Arguments:
bEnable : it is a kind of variable that selects whether basic status bar should be used or not. If TRUE, it uses, and if FALSE, it doesn't.
Description: This Method is used for deciding whether basic status bar should be used or not. Basic status bar is supposed to be not used as default. WiseVIEW ActiveX Control offers basic status bar showing the file names and the coordinates.
DisplayCoord
Declaration:
BOOL EnableStatusBar (BOOL bShow);
Arguments:
bShow: it is a kind of variable that decides whether display of the 3D coordinates should be used or not. If TRUE, it uses, and if not, it doesn't.
Description: This Method is used for deciding whether display of the 3D coordinates which shows the view point during the rotation of 3D drawing should be used or not.
SetPickMode
Declaration:
BOOL SetPickMode ();
Description: WiseVIEW offers the function that finds the coordinate of the specific part of drawing, and SetPickMode changes the status of menu to the finding the coordinates mode. In finding the Coordinates mode, if you select the specific part of drawing with the mouse, void PickPosition(double x, double y, double z) event occurs. x,y,z indicates the coordinates of a point which you select with the mouse.
3.4 Event Control
SendMessage
Declaration:
BOOL SendMessage(LPCTSTR Command);
Arguments:
Command: String value to control menus. Corresponding menus are listed below.
Description:
This Method is used for controlling all the application menus in WiseVIEW ActiveX Control.
4. Samples of WiseVIEW ActiveX Control
This selection presents the sample of applying WiseVIEW ActiveX Control by using Visual C++ and Visual Basic.
4-1. Visual C++ 4.0
- interface/activex/ActiveXTest.mdp
Step 1) creating application
Create application of Dialog based type with MFC AppWizard
Step 2) inserting WiseVIEW ActiveX Control
Insert WiseVIEW ActiveX Control into Project through Component menu in Insert menu
CUvOCX class gets created. (uvocx.h, uvocx.cpp)
WiseVIEW Control appears in Control panel, and insert into WiseVIEW Control dialog through general methods such as button control.
CUvOCX m_WiseVIEW
// ActiveXTestDlg.h
DDX_Control(pDX, IDC_WiseVIEW_CTRL, m_WiseVIEW)
// ActiveXTestDlg.cpp - DoDataExchange
Step 3) Control of WiseVIEW ActiveX Control
Make corresponding button to use Method of LoadFile, Print, EnableToolBar, EnableStatusBar, and SendMessage.
The sources of Click event are as follows.(ActiveXTestDlg.cpp)
void CActiveXTestDlg::OnLoadfile()
{
CfileDialog fdlg(TRUE, NULL, NULL, OFN_HIDEREADONLY, "*.*");
if(fdlg.DoModal() == IDOK)
{
Cstring path = fdlg.GetPathName();
m_WiseVIEW.LoadFile(path);
}
}
void CActiveXTestDlg::OnSendmessage()
{
CEdit* pEdit;
char msgStr[64];
pEdit = (CEdit*) GetDlgItem(IDC_TXT_MSG);
pEdit->GetWindowText(msgStr, 64);
m_WiseVIEW.SendMessage(msgStr);
pEdit->SetWindowText("");
}
void CActiveXTestDlg::OnEnableStatusbar()
{
m_bShowStatusbar = !m_bShowStatusbar;
m_WiseVIEW.EnableStatusBar(m_bShowStatusbar);
}
void CActiveXTestDlg::OnEnableToolbar()
{
m_bShowToolbar = !m_bShowToolbar;
m_WiseVIEW.EnableToolBar(m_bShowToolbar);
}
void CActiveXTestDlg::OnPrint()
{
m_WiseVIEW.Print();
}
Step 4) Sample of program performance
figure 1. Sample of ActiveXTest.exe performance(Visual C++)
4-2. Visual Basie 5.0
- interface/activex/vb/ActiveXTest.vbp
Step 1) Creating application
Create project as "standard Exe" type
Step 2) inserting wiseView ActiveX Control
Through composition element menu in Project menu, insert WiseVIEW ActiveX Control into Project.
WiseVIEW Control appears in Control panel, and insert into form through general methods such as button control. Declare the appropriate name of inserted control.
Step 3) Control of wiseVIEW ActiveX Control
Make corresponding button to use Method of LoadFile, Print, EnableToolBar, EnableStatusBar, and SendMessage.
The sources of Click event are as follows.(ActiveXTest.frm)
Dim bToolbar As Boolean
Dim bStatusbar As Boolean
Private Sub Btn_EnableStatusBar_Click()
bStatusbar = Not bStatusbar
WiseVIEWCtrl.EnableStatusBar bStatusbar
End Sub
Private Sub Btn_EnableToolBar_Click()
bToolbar = Not bToolbar
WiseVIEWCtrl.EnableToolBar bToolbar
End Sub
Private Sub Btn_Exit_Click()
Unload Me
End Sub
Private Sub Btn_LoadFile_Click()
Dim fileStr As String
fileStr = dhFileDialog (strInitDir:="", strFilter:="All Files(*.*)",
lngFlags:=dhOFN_OPENEXISTING)
If fileStr = "" Then
Exit Sub
End If
WiseVIEWCtrl.LoadFile fileStr
End Sub
Private Sub Btn_Print_Click()
WiseVIEWCtrl.SendMessage "Print File"
End Sub
Private Sub Btn_SendMessage_Click()
WiseVIEWCtrl.SendMessage Txt_Msg.Text
Txt_Msg.Text = ""
End Sub
Private Sub Form_Load()
bToolbar = False
bStatusbar = False
WiseVIEWCtrl.EnableToolBar bToolbar
WiseVIEWCtrl.EnableStatusBar bStatusbar
End Sub
Step 4) Sample of program performance
Figure 2. Sample of ActiveXTest.exe performance(Visual Basic)